(i) Field of the Invention
This invention relates to a method for preparing a compressed image data file, an image data compression device and a photographic device.
(ii) Description of the Related Art
In recent years, cameras have been increasingly incorporated into electronic devices including personal computers, PDAs and cellular phones. Like conventional digital cameras which are used specifically for photography, these devices are also capable of photographing still images and moving images. To inform a user of how many more pictures can be taken, a digital camera which is a device used specifically for photography generally has a function of estimating the number of pictures that can be still taken. In the era of film cameras, it was possible to clearly know the number of pictures that can be still taken since one film is physically consumed by each photographing. However, in the case of digital cameras which store pictures as digital data, users cannot clearly know the number of pictures that can be still taken without any devices since the data size of image data file produced by each photographing is generally not a constant value. If the number of pictures that can be still taken cannot be known, it is difficult for users to form a photographing plan, which is inconvenient for the users. Accordingly, conventional digital cameras used specifically for photography have a function of estimating the number of pictures that can be still taken by suppressing a variation in the data size of image data file produced by each photographing and keeping the data size as constant as possible.
The reason why the data size of image data file varies for each photographing in a digital camera is that the image data is compressed. To store as many image data in a data recording medium as possible, the image data are generally stored in the data recording medium in a compressed form. One or more compression parameters are associated with this compression, and in compression in JPEG format which is used in current digital cameras, compression parameters called Q factors and Q tables are associated with the compression. The data sizes of image data after compression vary depending on the contents of photographed images even if the image data are compressed with the same parameter. For this reason, when the same compression parameter value is used for all image data, the size of data file of produced compressed image varies for each photographing, and it turns out to be difficult to estimate the number of pictures that can be still taken. Consequently, as described in Japanese Patent Application Laid-Open No. 233373/1992, conventional devices used specifically for photography compress image data prepared by photographing with different compression parameter values, and when the image data could be compressed to a desired data size, the devices use the compressed image data for an image data file which is stored at the end, i.e. a compressed image data file to keep the data size of compressed image data file to be produced constant. Therefore, the value of compression parameter used for compression of image data differs for each photographing.
A method for preparing compressed image data in a conventional device used specifically for photography will be described by use of FIG. 13. FIG. 13 is a block diagram illustrating a conventional device used specifically for photography. A digital camera 202 which is a device used specifically for photography comprises a lens 204, a solid-state image sensor 206, an A/D converter 208, an image processing DSP 210, a CPU 212, a main storage unit 214, an external storage unit 216, a display 218 and a user interface 220 such as a shutter button. The digital camera 202 exchanges signals with these units via a bus 222. At the press of the shutter button of the user interface 220, the CPU 212 issues a command to initiate photographing, light having passed through the lens 204 is converted into an electrical signal by the solid-state image sensor 206, and the electrical signal is digitized by the A/D converter 208 and then stored in the main storage unit 214 temporarily. All signals output from all picture elements of the solid-state image sensor 206 are stored in the main storage unit 214 as digital data. Then, the DSP 210 reads out the digitized output signals of the solid-state image sensor 206 which are stored in the main storage unit 214 and prepares image data corresponding to one photographed frame from the data. The image data is in RGB format or YUV format. The DSP 210 stores the prepared image data corresponding to one frame in the main storage unit 214 temporarily.
Then, the DSP 210 reads out the prepared image data corresponding to one frame from the main storage unit 214, compresses the image data in JPEG format with a compression parameter set at a predetermined value to prepare a compressed image data file, and measures the data size of the compressed image data file. If the data size is not a desired data size, the DSP 210 discards the compressed image data file, reads out the prepared image data from the main storage unit 214 again, compresses the image data in JPEG format with a different compression parameter value and measures the data size after compression. The DSP 210 repeats the above operations to prepare compressed image data which is a final output from image data compressed with a compression parameter value with which the desired data size is achieved and stores the compressed image data in the external storage unit 216.
In summary, to keep the data sizes of compressed image data files obtained by compressing image data as constant as possible, the method for preparing a compressed image data file which is implemented in conventional digital cameras comprises compressing entire image data to be compressed with a compression parameter value, checking the size of the compressed data, and compressing the entire image data to be compressed again with another compression parameter value when the size of the compressed data is larger than a desired size.